package com.szrt.java.day20161228.demo02;

import java.util.Arrays;


/**
 * 80%
 * @author zsrt
 *
 */
public class PopSort01 {
	
	public static void main(String[] args) {
		
		int[] arrays ={90,80,70,60,50};
		
		System.out.println(Arrays.toString(arrays));
		
		for(int outer=1;outer<=4;outer++){
			
			
			for(int inner=1;inner<=5-outer;inner++){
				
				//关键代码
				int first = inner-1;
				
				int second =inner;
				
				if(arrays[first]>arrays[second]){
					
					int temp = arrays[first];
					arrays[first]= arrays[second];
					arrays[second] =temp;
					
				}
				
			}
			System.out.println(Arrays.toString(arrays));
			
		}
		
		System.out.println(Arrays.toString(arrays));
	}

}
